package com.example.wxback.service;

import com.example.wxback.dao.IUserMessageDao;
import com.example.wxback.model.MessageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class UserMessageService {

    @Autowired
    private IUserMessageDao userMessageDao;

    /**
     * 检查消息
     */
    public MessageInfo getMessage(MessageInfo messageInfo) {
        return userMessageDao.getMessage(messageInfo);
    }

    /**
     * 插入消息
     */
    public boolean insertMessage(MessageInfo messageInfo) {
        return userMessageDao.insertMessage(messageInfo) > 0;
    }

    /**
     * 更新消息
     */
    public boolean updateMessage(MessageInfo messageInfo) {
        return userMessageDao.updateMessage(messageInfo) > 0;
    }

    /**
     * 获取消息列表
     */
    public List<MessageInfo> getMessageList(int userId) {
        return userMessageDao.getMessageList(userId);
    }
}
